package com.woniu.userservice.service.impl;

import com.woniu.userservice.entity.Users;
import com.woniu.userservice.dao.UsersDao;
import com.woniu.userservice.service.UsersService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("usersService")
public class UsersServiceImpl implements UsersService {
    @Resource
    private UsersDao usersDao;

    @Override
    public Users queryById(Integer id) {
        return usersDao.queryById(id);
    }

    @Override
    public List<Users> queryAllByLimit(int offset, int limit) {
        return usersDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<Users> findAll() {
        return usersDao.findAll();
    }

    @Override
    public Users insert(Users users) {
        usersDao.insert(users);
        return users;
    }

    @Override
    public Users update(Users users) {
        usersDao.update(users);
        return queryById(users.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return usersDao.deleteById(id) > 0;
    }
}